define(['util/utils'], function (util) {

    return {
        /**
         * 从 localStorage 获取数据
         * @param key
         * @returns {string}
         */
        getStorage: function getStorage(key) {
            return window.localStorage.getItem(key)
        },

        /**
         * 添加数据到 localStorage
         * @param key
         * @param value
         */
        setStorage: function setStorage(key, value) {
            let _data;
            if(util.isAnyType(value,'object', 'array')) {
                _data = JSON.stringify(value);
            } else {
                _data = value;
            }
            return window.localStorage.setItem(key, _data)
        },
    }
});
